#include "Task.h"
#include <string>
Task::Task()
{
//initialize variables
 taskName ="";
 taskDescription = "what the hell";
 taskTag ="";
 taskDate = new int[3];
 taskStart =new int[2] ;
taskEnd = new int[2];
 index = 0;
 

}
//getter methods
string Task::getName() {
	return taskName;
}

string Task::getDescription() {
	return taskDescription;
}

string Task::getTag() {
	return taskTag;
}

int* Task::getDate() {
	return taskDate;
}
int* Task::getIndex()
{

 return index;

}
int* Task::getTime() {
	int time[4];
	time[0] = taskStart[0];
	time[1] = taskStart[1];
	time[2] = taskEnd[0];
	time[3] = taskEnd[1];
	return time;
}

//setter methods
void Task::setName(string name) {
	taskName = name;
}

void Task::setDescription(string des) {
	taskDescription = des;
}

void Task::setTag(string tag) {
	taskTag = tag;
}
void Task::setDate(int date[]) {
	taskDate[0] = date[0];
	taskDate[1] = date[1];
	taskDate[2] = date[2];
}

//The function takes in the start time(at index 0&1) and the end time (at index 2&3).
//If no end time is specified, the program assumes the duration of the task is 1 hour
//by default.
void Task::setTime(int time[]) {
	Task::taskStart[0] = time[0];
	Task::taskStart[1] = time[1];

	if(sizeof(time) == 2) {
		Task::taskEnd[0] = Task::taskStart[0] + 1;
		Task::taskEnd[1] = Task::taskStart[1];
	} else {
		Task::taskEnd[0] = time[2];
		Task::taskEnd[1] = time[3];
	}
}
string Task::toString()
{
	
	string builder1 = "TaskName: "+Task::getName()+"->";
	
	string builder2 ="TaskDescription: "+(Task::getDescription())+"->";
	string builder3 = "TaskTime: "+ Task::NumberToString(Task::taskDate[0])+"--"+Task::NumberToString(Task::taskDate[1])+"--"+Task::NumberToString(Task::taskDate[2])+"\n";
	
	return builder1+builder2+builder3;



}
string Task::NumberToString ( int Number )
  {
     ostringstream ss;
     ss << Number;
     return ss.str();
  }
